/**
 * Copyright (c) 2007, Ashish Lijhara
 * All rights reserved.
 *
 * clockContainer.java
 *
 */

package crazy.java.Aetas;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Transparency;
import java.awt.image.BufferedImage;
import java.util.TimeZone;
import javax.swing.JPanel;

/**
 *
 * @author Ashish a.k.a Java Crazy
 */
public class clockContainer extends JPanel{
    private BufferedImage containerImage;
    public clockContainer(){
        setLayout(new GridBagLayout());
        GridBagConstraints c=new GridBagConstraints();
        
        
        JPanel panel=new ReflectionPanel("res/Asia.png",TimeZone.getDefault().getDisplayName(),"asia");
        
        c.gridx = 0;
        c.gridy = 0;
        add(panel,c);
        
        JPanel panel1=new ReflectionPanel("res/NorthAmerica.png",TimeZone.getDefault().getDisplayName(),"america");
        
        c.gridx = 6;
        c.gridy = 0;
        add(panel1,c);
        setOpaque(false);
    }
    
    public void paint(Graphics g){
        
        if (containerImage == null || containerImage.getWidth() != getWidth() ||
                containerImage.getHeight() !=getHeight()) {
            containerImage = getGraphicsConfiguration().
                    createCompatibleImage(getWidth(), getHeight(),Transparency.TRANSLUCENT);
        }
        
        super.paint(g);
        Graphics2D g2=(Graphics2D)g;
        g2.drawImage(containerImage, 0, 0, null);
    }
}
